package put.io.composite.dp;

import java.util.ArrayList;

public class Composite extends Component {
	private ArrayList<Component> elements = new ArrayList<Component>();

	public Composite() {
	}

	@Override
	public void operation() {
		for (Component element : elements) {
			element.operation();
		}
	}

	public void add(Component element) {
		elements.add(element);
	};

	public void remove(Component element) {
		elements.remove(element);
	};

	public Component getChild(int id) {
		return elements.get(id);
	};
}
